<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <script type="text/javascript" src="../script/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../script/api.js"></script>
    <style>
        header{ background-color: #FCFCFC; line-height: 60px; height: 60px; position: relative; }
        header b{ width: 60px; height: 100%; display: inline-block; position: relative; z-index: 1; background: url() no-repeat center; background-size: 70% auto;  }
        header b.ic-back{ background-image: url(../image/ic-back.png); }
        header b.ic-check{ background-image: url(../image/ic-check.png); float: right; }
        header .title{ position: absolute; left: 0; bottom: 0; right: 0;  text-align: center; font-size: 18px;  }
        .swipe {overflow: hidden;position: relative;}
        .swipe-wrap {overflow: hidden; position: relative;}
        .swipe-wrap .swipe-con { float:left; position: relative;}
        .swipe-wrap .swipe-con img{ width:100%; vertical-align: middle;  }
        #main{ padding: 2px; background-color: #e5e5e5;  }
        #main .flex-vertical .layout{ background:#e66961 url() right bottom no-repeat; margin: .3rem;  padding: .3rem; background-size: auto 50%; line-height: 2rem;  color: white; font-size: 1.8rem; }
        #main .flex-vertical .layout p{ font-size: 1rem; }
        #main .flex-vertical .layout.ic-hot{ background-image: url(../image/ic-hot.png); }
        #main .flex-vertical .layout.ic-article{ background-image: url(../image/ic-hot.png); background-color: #6ab494; font-size: 1.6rem;}
        #main .flex-vertical .layout.ic-tag{ background-image: url(../image/ic-hot.png); background-color: #9e9a8d; font-size: 1.6rem;}
        #main .flex-vertical .layout.ic-coffee{ background-image: url(../image/ic-coffee.png); background-color: #ebd275;  font-size: 1.6rem;}
        #main .flex-vertical .layout.ic-shop{ background-image: url(../image/ic-shop.png); background-color: #6ab494; font-size: 1.6rem;}
        #main .flex-vertical .layout.ic-like{ background-image: url(../image/ic-like.png); background-color: #d8c09d; font-size: 1.6rem;}
        #main .flex-
         .layout.ic-lable{ background-image: url(../image/ic-lable.png); font-size: 1.2rem;}
        #main .flex-vertical .layout.ic-more{ background-image: url(../image/ic-more.png); background-color: #669933; font-size: 1.6rem; background-size: 
         50% auto; background-position: center right; }
        .flex-2{ -webkit-box-flex: 2;     -webkit-flex: 2;    flex: 2; }
        .hover{ opacity: .8; }
    </style>
</head>
<body>
    <div id="wrap" class="flex-wrap flex-vertical" >
        <header class="border-b" >
            <b tapmode="hover" ></b>
            <div class="title">成都弥荣PDA</div>
            <b tapmode="hover" ></b>
        </header>
        <div id="main" class="flex-wrap flex-con" >
             <div id="divItem" class="flex-con flex-wrap flex-vertical">
                 <div id="divSHY" tapmode="hover" onclick="funOpenSHY(this);" class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout ic-hot">
                        <h6>外观检查</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divLWCX" tapmode="hover" onclick="funOpenLWCX(this);" class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout ic-hot">
                        <h6>联网查询</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divCLWYXJC" tapmode="hover" onclick="funOpenCLWYXJC(this);" class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout ic-hot">
                        <h6>车辆唯一性检查</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divCLTZCS" tapmode="hover" onclick="funOpenCLTZCS(this);" class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout ic-hot">
                        <h6>车辆特征参数检查</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divDT" tapmode="hover" onclick="funOpenDtdp(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout ic-shop">
                        <h6>底盘动态检验</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divDP" tapmode="hover" onclick="funOpenDpbj(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout  ic-coffee">
                        <h6>底盘部件检验</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divLS" tapmode="hover" onclick="funOpenLsxx(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout  ic-like">
                        <h6>路试</h6>
                        <p></p>
                     </div>
                 </div>
                <div id="divTCSX" tapmode="hover" onclick="funOpenTcsx(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout  ic-more">
                        <h6>提车上线</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divTCSX_HN" tapmode="hover" onclick="funOpenTcsx_HN(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout  ic-more">
                        <h6>提车上线</h6>
                        <p></p>
                     </div>
                 </div>
                 <div id="divPFWGJC" tapmode="hover" onclick="funOpenPfwg(this);"  class="flex-wrap flex-con layout-wrap">
                     <div class="flex-con layout  ic-more">
                        <h6>排放外观检查</h6>
                        <p></p>
                     </div>
                 </div>
             </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/swipe.js"></script>
<script type="text/javascript">
    var vDt;
    var vConType = '1';
    var vLWCX_IsShow = '0';
    apiready = function(){  
        StartConn();
        GetLWCX_IsShow();
    };

    // 得到是否显示联网查询
    function GetLWCX_IsShow()
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');

        api.ajax({
                url: vUrlRead + '/WcfServices/LWCX_IsShow',
                method: 'Post',
                contentType: "application/json",
            }, function(ret, err) {
                 if (ret.IsSuccess) {
                    vLWCX_IsShow=ret.Data;
                    GetPDAAuthority();
            }
        });
    }

    function GetPDAOnlineStatus(conType)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');

        api.ajax({
                url: vUrlRead + '/WcfServices/PDAOnlineStatus',
                method: 'Post',
                contentType: "application/json",
            }, function(ret, err) {
                 if (ret.PDAOnlineStatusResult) {
                    vConType='1';
            } else {
                StopConn();
                if(conType == '1')
                {
                    api.confirm({
                    title: '提示',
                    msg: '服务器断开, 是否继续连接？',
                    buttons: ['是', '否']
                    }, function(ret, err) {
                        var index = ret.buttonIndex;
                        if(index == 0)
                        {
                            vConType='1';
                        }
                        if(index == 1)
                        {
                            vConType='2';
                        }
                        StartConn();
                    });
                }

                return;
            }
        });  
    }

    function StartConn()
    {
        vDt = setInterval("GetPDAOnlineStatus('" + vConType +"')", 10000);
    }

    function StopConn()
    {
        clearInterval(vDt);
    }

    function GetPDAAuthority()
    {
        $("#divWG").hide();
        $("#divLWCX").hide();
        $("#divCLWYXJC").hide();
        $("#divCLTZCS").hide();
        $("#divDT").hide();
        $("#divDP").hide();
        $("#divLS").hide();
        $("#divFJ").hide();
        $("#divTCSX").hide();
        $("#divTCSX_HN").hide();
        $("#divPFWGJC").hide();
        var vUserTYPE = $api.getStorage('UserType');
        var array=vUserTYPE.split(",");

        for(var i=0;i<array.length; i++)
        {
            if(array[i] == "03")
            {
                $("#divWG").show();
                if(vLWCX_IsShow == '1')
                {
                    $("#divLWCX").show();
                }
                $("#divCLWYXJC").show();
                $("#divCLTZCS").show();
            }
            if(array[i] == "06")
            {
                $("#divDT").show();
            }
            if(array[i] == "05")
            {
                $("#divDP").show();
            }
            if(array[i] == "10")
            {
                $("#divLS").show();
            }
            if(array[i] == "09")
            {
                $("#divTCSX").show();
            }
            if(array[i] == "13")
            {
                $("#divTCSX_HN").show();
            }
            if(array[i] == "18")
            {//排放外检员
                $("#divPFWGJC").show();
            }
        }
    }

    function funOpenSHY( tag ){
        api.openWin({
            name: 'win_shyhome',
            url: '../html/shy/win_shyhome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenDtdp( tag ){
        api.openWin({
            name: 'win_dthome',
            url: '../html/dtdp/win_dthome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenDpbj( tag ){
        api.openWin({
            name: 'win_dphome',
            url: '../html/dpbj/win_dphome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenLsxx( tag ){
        api.openWin({
            name: 'win_lshome',
            url: '../html/lsxx/win_lshome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenFjdl( tag ){
        api.openWin({
            name: 'win_fjdlhome',
            url: '../html/fjdl/win_fjdlhome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenTcsx( tag ){
        api.openWin({
            name: 'win_tcsxhome',
            url: '../html/tcsx/win_tcsxhome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenTcsx_HN( tag ){
        api.openWin({
            name: 'win_tcsxhome',
            url: '../html/tcsx_hn/win_tcsxhome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenPfwg( tag ){
        api.openWin({
            name: 'win_pfwghome',
            url: '../html/pfwgjc/win_pfwghome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenLWCX( tag ){
        api.openWin({
            name: 'win_lwcxhome',
            url: '../html/lwcx/win_lwcxhome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenCLWYXJC( tag ){
        api.openWin({
            name: 'win_clwyxjchome',
            url: '../html/clwyxjc/win_clwyxjchome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }

    function funOpenCLTZCS( tag ){
        api.openWin({
            name: 'win_cltzcsjchome',
            url: '../html/cltzcsjc/win_cltzcsjchome.html',
            pageParam: {
                name: tag.querySelector('h6').innerHTML
           }
        });
    }
</script>